<!-- 新增数据页面 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">
$(function() {
	progressClose();
  	
	$('#icon').combobox({
		data : $.organizationIconDatas,
			formatter : function(v) {
				return $.formatString('<span class="{0}" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span>{1}', v.value, v.value);
			}
	});
  	
	$('#pid').combotree({
          url : '${pageContext.request.contextPath }/sys/organization/tree',
          parentField : 'pid',
          lines : true,
          panelHeight : 'auto'
	});
      
	$('#addForm').form({
		url : '${pageContext.request.contextPath }/sys/organization/add',
		onSubmit : function() {
              progressLoad();
              var isValid = $(this).form('validate');
              if (!isValid) {
                  progressClose();
              }
              return isValid;
          },
          success : function(result) {
              progressClose();
              result = $.parseJSON(result);
              if (result.success) {
              	parent.$.messager.alert('提示', result.msg, 'info');
                  parent.$.modalDialog.openner_treeGrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为organization.jsp页面预定义好了
                  parent.$.modalDialog.handler.dialog('close');
              }else{
              	parent.$.messager.alert('错误', result.msg, 'error');
              }
          }
	});
	
});//$(function() { End
</script>
<div class="easyui-layout" data-options="fit:true,border:false" >
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;" >
        <form id="addForm" method="post" >
            <table class="grid">
	            <tr>
	                <td>编号</td>
	                <td><input name="code" type="text" placeholder="请输入部门编号" class="easyui-validatebox" data-options="required:true" ></td>
	                <td>部门名称</td>
	                <td><input name="name" type="text" placeholder="请输入部门名称" class="easyui-validatebox" data-options="required:true" ></td>
	            </tr>
	            <tr>
	                <td>排序</td>
	                <td><input name="seq"  class="easyui-numberspinner" style="width: 140px; height: 29px;" required="required" data-options="editable:false" value="0"></td>
	                <td>图标</td>
	                <td><input id="icon" name="icon" style="width: 200px; height: 29px;" data-options="editable:false" /></td>
	            </tr>
	            <tr>
	                <td>地址</td>
	                <td colspan="3"><input  name="address" style="width: 300px;"/></td>
	            </tr>
	            <tr>
	                <td>上级部门</td>
	                <td colspan="3"><select id="pid" name="pid" style="width:200px;height: 29px;"></select>
	                <a class="easyui-linkbutton" href="javascript:void(0)" onclick="$('#pid').combotree('clear');" >清空选择</a></td>
	            </tr>
	        </table>
        </form>
    </div>
</div>